<template>
  <div class="z-card">
    <div class="z-header" ref="header">
      <slot name="header"></slot>
    </div>
    <div class="z-main" ref="main">
      <slot></slot>
    </div>
  </div>
</template>

<script>
export default {
  name: "z-card",
  mounted() {
    //15 底部padding
    const h = this.$refs.header.clientHeight + 15 + "px";
    this.$refs.main.style.height = `calc(100% - ${h})`;
  },
};
</script>

<style lang="scss" scoped>
.z-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 15px;
  background: #fff;
  border-radius: 16px;

  .z-header {
    margin-bottom: 15px;
  }
}
</style>
